<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <cc:interface         
        shortDescription="table column 3, lable, value, message. only in panelGrid">
        <!-- TODO: f:ajax not work, fix it-->
        <cc:attribute name="idd" required="true" shortDescription="id"/>        
        <cc:attribute name="value"/>
        <cc:attribute name="required" default="false"/>
        <cc:attribute name="label" required="true"/>
        <cc:attribute name="escape" default="true"/>
        <cc:attribute name="tips" shortDescription="input tips,输入提示"/>

        <cc:attribute name="converter"/>
        <cc:attribute name="enableValidator" default="false"/>
        <cc:attribute 
            name="validator" 
            method-signature="void Action(javax.faces.context.FacesContext,
            javax.faces.component.UIComponent,Object)"
            shortDescription="方法验证，非注册验证，使用时enableValidator必须为true"/>    

    </cc:interface>
    <cc:implementation> 
        <tr>
            <td>
                <p:outputLabel 
                    style="border: none!important;white-space: nowrap;"
                    value="#{msgs[cc.attrs.label]}" 
                    for="#{cc.attrs.idd}"/>
            </td>

            <td>
                <c:if test="#{!cc.attrs.enableValidator}">
                    <p:inputText                        
                        id="#{cc.attrs.idd}"
                        value="#{cc.attrs.value}"       
                        converter="#{cc.attrs.converter}"
                        required="#{cc.attrs.required}">
                        <cc:insertChildren/>
                    </p:inputText>
                </c:if>

                <c:if test="#{cc.attrs.enableValidator}">
                    <p:inputText 
                        id="#{cc.attrs.idd}"
                        value="#{cc.attrs.value}" 
                        validator="#{cc.attrs.validator}"
                        converter="#{cc.attrs.converter}"
                        required="#{cc.attrs.required}">
                        <cc:insertChildren/>
                    </p:inputText>
                </c:if>
            </td>

            <td style="position: relative;white-space: nowrap;">
                <div style="float: left;margin-left: 6px;">
                    <h:outputText value="#{empty cc.attrs.tips ? '&nbsp;' : cc.attrs.tips}"/>
                </div>
                <div style="position: absolute;margin-top: 0;">                    
                    <p:message for="#{cc.attrs.idd}"/>
                </div>             
            </td>
        </tr>
    </cc:implementation>
</html>